package com.hpeu_01.day0114.homework;

import java.util.Calendar;
import java.util.Date;

/**
 * 第一题：利用Calendar类获取当前时间中年份、月份、日期、时分秒，并打印出来。
 */
public class HomeWork01 {
    public static void main(String[] args) {
        Calendar calendar = Calendar.getInstance();
        //获取年
        int year = calendar.get(Calendar.YEAR);
        //获取月
        int month = calendar.get(Calendar.MONTH);
        //获取日
        int day = calendar.get(Calendar.DAY_OF_MONTH);
        //获取星期
        int week = calendar.get(Calendar.DAY_OF_WEEK);
        String weeks[]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
        //获取时
        int hour = calendar.get(Calendar.HOUR_OF_DAY);
        //获取分
        int minute = calendar.get(Calendar.MINUTE);
        //获取秒
        int second = calendar.get(Calendar.SECOND);
        System.out.println(year+"年"+(month+1)+"月"+day+"日 "+weeks[week-1]+" "+hour+":"+minute+":"+second);

    }
}
